home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / net / bind-contrib.tar.gz / bind-contrib.tar / contrib / misc / soa-easy.shar / make-depend < prev    next >
Encoding:
Text File  |  1996-10-25  |  1.0 KB  |  48 lines

  1. #!/usr/local/bin/perl
  2. # make-depend -    Output SOA-file dependencies, in make(1) format
  3. #
  4. # $Id: soa-easy.shar,v 8.2 1996/10/25 17:08:00 vixie Exp $
  5. # $Source: /proj/src/isc/cvs-1/bind/contrib/misc/soa-easy.shar,v $
  6. #
  7. # SYNOPSIS
  8. #    make-depend SOA-file ...
  9.  
  10.  
  11. $prog = 'make-depend';
  12.  
  13. foreach $file (@ARGV) {
  14.     $zone_file = $file;
  15.     $zone_file =~ s/\.SOA$/.zone/;
  16.     @dependencies = &find_includes ($zone_file);
  17.     @dependencies = grep (! /\.SOA$/, @dependencies);
  18.     print ($file, " :    ", join (' ', @dependencies), "\n");
  19. }
  20.  
  21.  
  22. #######################################################################
  23. # find_includes -    Look for $INCLUDE-ed files
  24. #
  25. sub find_includes {
  26.     local ($file) = shift (@_);
  27.  
  28.     local (@parts);
  29.     local (@includes);
  30.  
  31.     if (! open (FILE, $file)) {
  32.     warn "$prog: warning: can't open $file: $!\n";
  33.     return ();
  34.     }
  35.  
  36.     while (<FILE>) {
  37.     s/;.*$//;
  38.     if (/\$INCLUDE\s/) {
  39.         @parts = split;
  40.         if (! grep ($_ eq $parts[1], @includes)) {
  41.         push (@includes, $parts[1]); }
  42.     }
  43.     }
  44.     close (FILE);
  45.  
  46.     return (@includes);
  47. }
  48.